﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Windows.Input;
using System.Windows.Forms;
using System.Drawing;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;


namespace TestProject1.Tree
{
    /// <summary>
    /// Summary description for CodedUITest1
    /// </summary>
    [CodedUITest]
    public class ValiditiesUI
    {
        public ValiditiesUI()
        {
        }

        [TestMethod]
        public void OpenValititySol()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.StartOTF();
            this.UIMap.LoadValiditySol();
            this.UIMap.ExpandValiditySol();
        }

        [TestMethod]
        public void Val_Add()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.AddNewVal1();
            this.UIMap.CheckDoc1Val1();
        }

        [TestMethod]
        public void Val_UndoRedoAdd()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckUndoAddNewVal1();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc1Val1();
        }

        [TestMethod]
        public void Val_ChangeSpec()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.OpenVal1Prop();
            this.UIMap.ChangeValSpec();
            this.UIMap.OpenVal1Prop();            
            this.UIMap.CheckValSpecChanged();
            this.UIMap.ClickOKValProp();
        }

        [TestMethod]
        public void Val_UndoRedoChangeSpec()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.ClickUndo();
            this.UIMap.OpenVal1Prop();
            this.UIMap.CheckValSpecChangedUndo();
            this.UIMap.ClickCancelValProp();
            this.UIMap.ClickRedo();
            this.UIMap.OpenVal1Prop();
            this.UIMap.CheckValSpecChanged();
            this.UIMap.ClickOKValProp();
        }

        [TestMethod]
        public void Val_InputProcedureValidFor()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.InputDoc2ProcMainValidFor();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.InputDoc3ProcMainValidFor();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoInputProcedureValidFor()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();            
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();            
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_InputActivityValidFor()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.InputDoc2ProcMainAss1ValidFor();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();

            this.UIMap.InputDoc3ProcMainAss1ValidFor();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoInputActivityValidFor()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463

            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult1();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_Rename()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.RenameVal1();
            this.UIMap.CheckDoc1Val12();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoRename()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc1Val1();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc1Val12();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_RenameProperty()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.OpenVal12Prop();
            this.UIMap.RenameVal12Prop();
            this.UIMap.ClickOKValProp();
            this.UIMap.CheckDoc1Val123();           
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoRenameProperty()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc1Val12();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc1Val123();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_ChangeValueDirect()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.OpenVal123Prop();
            this.UIMap.ChangeValConditionDirect();           
            this.UIMap.ClickOKValProp();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoChangeValueDirect()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.OpenVal123Prop();
            this.UIMap.CheckChangeValConditionDirectUndo();
            this.UIMap.ClickCancelValProp();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenVal123Prop();
            this.UIMap.CheckChangeValConditionDirectRedo();
            this.UIMap.ClickCancelValProp();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_ChangeValueIndirect()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ChangeValConditionIndirect();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_UndoRedoChangeValueIndirect()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult3();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
        }

        [TestMethod]
        public void Val_ChangeVisibility()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.OpenVal123Prop();
            this.UIMap.ChangeVal123Visibility();
            this.UIMap.ClickOKValProp();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerWarning();
            this.UIMap.ClickOKErrorExecuteWF();
        }

        [TestMethod]
        public void Val_UndoRedoChangVisibility()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.ClickRedo();
            this.UIMap.OpenDoc2ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerResult0();
            this.UIMap.ClickOKConfirmDialog();
            this.UIMap.OpenDoc3ProcSignatureCaller();
            this.UIMap.ExecuteCurrentWF();
            this.UIMap.CheckProcSigCallerWarning();
            this.UIMap.ClickOKErrorExecuteWF();
        }

        [TestMethod]
        public void Val_Copy()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.CopyDoc1Val123();
            this.UIMap.PasteDoc2Val123();
            this.UIMap.ExpandDoc2ValNode();
            this.UIMap.CheckDoc2Val123();
            this.UIMap.CopyDoc2Val123();
            this.UIMap.PasteDoc3Val123();
            this.UIMap.ExpandDoc3ValNode();
            this.UIMap.CheckDoc3Val123();
        }

        [TestMethod]
        public void Val_UndoRedoCopy()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc3Val123NotExist();
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc2Val123NotExist();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc2Val123();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc3Val123();
        }

        [TestMethod]
        public void Val_Cut()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.CutDoc2Val123();
            this.UIMap.PasteDoc3Val123();
            this.UIMap.CheckDoc3CopyOfVal123();
            this.UIMap.CheckDoc2Val123NotExist();
            this.UIMap.CutDoc3Val123_A();
            this.UIMap.PasteDoc2Val123();
            this.UIMap.CheckDoc2Val123();
            this.UIMap.CheckDoc3Val123NotExist_A();
        }

        [TestMethod]
        public void Val_UndoRedoCut()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc2Val123NotExist();
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc3Val123();
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc3CopyOfVal123NotExist();            
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc2Val123();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc2Val123NotExist();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc3CopyOfVal123();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc3Val123NotExist();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc2Val123();
        }


        [TestMethod]
        public void Val_Delete()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.Val_Delete();
            this.UIMap.CheckDoc3Val123NotExist();
            this.UIMap.DeleteDoc3CopyOfVal123();
            this.UIMap.CheckDoc3CopyOfVal123NotExist();
        }

        [TestMethod]
        public void Val_UndoRedoDelete()
        {
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc3CopyOfVal123();
            this.UIMap.ClickUndo();
            this.UIMap.CheckDoc2Val123();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc3Val123NotExist();
            this.UIMap.ClickRedo();
            this.UIMap.CheckDoc3CopyOfVal123NotExist();
        }
        #region Additional test attributes

        // You can use the following additional attributes as you write your tests:

        ////Use TestInitialize to run code before running each test 
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{        
        //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //    // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        //}

        ////Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{        
        //    // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        //    // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
        //}

        #endregion

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }
        private TestContext testContextInstance;

        public UIMap UIMap
        {
            get
            {
                if ((this.map == null))
                {
                    this.map = new UIMap();
                }

                return this.map;
            }
        }

        private UIMap map;
    }
}
